<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:pe="http://primefaces.org/ui/extensions"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions">
    <ui:composition template="/layout/masterPageNotHeaderSearch.xhtml">
        <f:metadata>

            <f:event type="preRenderView" listener="#{sys_NguoiDungController.onPageLoad_CheckUsers()}">

            </f:event>
        </f:metadata>
        <ui:define name="ui-header">
            <title>#{utilsController.getLanguages("QuanLyTinDang")}</title>
        </ui:define>


        <ui:define name="ui-content">
            <div class="container content bg-gradient-body">
                <div class="heading heading-v1 margin-bottom-50">
                    <h2 class="headerColor" style="font-size: 35px;">#{utilsController.getLanguages("TinBanXe")}</h2>
                </div>
                <div class="row">
                    <div class="col-md-12" style="padding-left: 10px;padding-right: 10px;">
                        <h:form id="frmtinbanxe">
                            <c:set var="vbangtin" value="#{c_DangTinController.findAllBangTin()}" scope="session"/>
                            <div class="panel panel-dark" style="border-radius: 10px 10px 0 0 !important;">
                                <div class="panel-heading" style="border-radius: 10px 10px 0 0 !important;">
                                    <h3 class="panel-title" style="text-align: right">
                                        <button type="button" class="btn-u btn-u-default rounded-custom-def" onclick="TaoMoiTin();">
                                            <i class="fa fa-plus-circle"></i> #{utilsController.getLanguages("TaoMoi")}</button>
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    <table class="table table-bordered">
                                        <thead style="background: url('/resourcesApp/img/darkgrain.png') repeat scroll 0 0 #f6f6f6">
                                            <tr>
                                                <th>#{utilsController.getLanguages("ID")}</th>
                                                <th>#{utilsController.getLanguages("NgayHieuLuc")}</th>
<!--                                                <th>#{utilsController.getLanguages("LuotUp")}</th>-->
                                                <th>#{utilsController.getLanguages("SoNguoiXem")}</th>
<!--                                                <th>#{utilsController.getLanguages("UpTuDong")}</th>-->
                                                <th>#</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <c:forEach items="#{vbangtin}" var="item">
                                                <c:if test="#{item.getLoaiTin()==1}">
                                                    <tr>
                                                        <td>#{item.getID()}</td>
                                                        <td>#{utilsController.parseDate(item.getNgayHieuLuc(), "dd/MM/yyyy HH:mm:ss")}</td>
<!--                                                        <td>#{item.getLuotUp()}</td>-->
                                                        <td>#{item.getSoNguoiXem()}</td>
<!--                                                        <td>#{item.getUpTuDong()}</td>-->
                                                        <td>
                                                            <c:choose>
                                                                <c:when test="#{item.getTuKhoaTimKiem()=='2'}">
                                                                     <a class="btn btn-info btn-xs rounded" href="/motobike.html?id=#{item.getID()}"  ><i class="fa fa-file-text-o"></i> #{utilsController.getLanguages("ViewItem")}</a>
                                                                </c:when>
                                                                <c:otherwise>
                                                                     <a class="btn btn-info btn-xs rounded" href="/detail.html?id=#{item.getID()}"  ><i class="fa fa-file-text-o"></i> #{utilsController.getLanguages("ViewItem")}</a>
                                                                </c:otherwise>
                                                            </c:choose>
                                                           
                                                           
                                                            <button class="btn btn-success btn-xs rounded" type="button" onclick="Update_tinban_Click('#{item.getID()}');"><i class="fa fa-edit"></i> #{utilsController.getLanguages("Update")}</button>
<!--                                                            <button class="btn btn-primary btn-xs rounded" type="button" onclick="Update_tinban_Click('#{item.getID()}');"><i class="fa fa-truck-o"></i> #{utilsController.getLanguages("UpTin")}</button>
                                                            <button class="btn btn-primary btn-xs rounded" type="button" onclick="Update_tinban_Click('#{item.getID()}');"><i class="fa fa-truck-o"></i> #{utilsController.getLanguages("TuDongUpTin")}</button>-->
                                                            <button class="btn btn-danger btn-xs rounded" onclick="Delete_tinban_Click('#{item.getID()}', '#{utilsController.getLanguages('CoChacBanMuonXoaDuLieu')}');" type="button"><i class="fa fa-trash-o"></i> #{utilsController.getLanguages("Delete")}</button>
                                                        </td>
                                                    </tr>
                                                </c:if>


                                            </c:forEach>


                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <p:remoteCommand name="cmd_Delete_tinban" actionListener="#{c_DangTinController.cmd_Delete_Click}" update=":frmtinbanxe"></p:remoteCommand>
                            <p:remoteCommand name="cmd_Update_tinban" actionListener="#{c_DangTinController.cmd_Update_Click}" update=":frmtinbanxe"></p:remoteCommand>
                            <p:remoteCommand name="cmd_New_tinban" actionListener="#{c_DangTinController.cmd_New_Click}" update=":frmtinbanxe"></p:remoteCommand>
                            <p:remoteCommand name="cmdChiTietTinNhan" actionListener="#{c_DangTinController.cmdChiTietTinNhan_Click}"></p:remoteCommand>
                        </h:form>
                    </div>
                </div>
            </div>
        </ui:define>
    </ui:composition> 
</html>